<style>
#list td {
	border-bottom:#13B1E4 1px solid;
	border-right:#13B1E4 1px solid;}

</style>


<script type="text/javascript">

function doDelete(url)
{
	var a = confirm('Are you sure?');
	if(a)
	{
		window.location = url;
	}
}
</script>
<!-- CONTENT START -->
<div id="content">

<!-- LEFT START -->
<?php
include('themes/'.$this -> theme.'/left.php');
?>
<!-- LEFT END -->

<!-- RIGHT START -->
<div id="right">

<h2 class="right_heading">Category Manager</h2>
<div id="shop_anounce">
<form action="?page=categoryManager&sub=<?=$action?>" method="post">
<input type="hidden" name="pCatId" value="<?=$pCatId?>" />
<input type="hidden" name="catId" value="<?=$editCat['categoryID']?>" />
<table width="450">
<tr>
	<td>Category Name</td>
	<td align="left" valign="baseline"><input type="text" name="catName" id="catName" value="<?=$editCat['categoryName']?>" size="40" /></td>
</tr>

<tr>
	<td>Category Detail</td>
	<td align="left" valign="baseline"><textarea name="catDetail" id="catDetail" cols="30" rows="3"><?=$editCat['categoryDetail']?></textarea></td>
</tr>
<tr>
	<td>&nbsp;</td>
	<td colspan="2" align="left" valign="baseline">
    <input  type="submit" value="<?=($action=="saveCategory"? "Save" : "Update")?> Category" /></td>
</tr>
</table>
</form>

<br /><br />
<? if($levelUpId!=-1): ?>
<input type="button" value="One Level Up" onclick="window.location='?page=categoryManager&pCatId=<?=$levelUpId?>'"/>
<img src="iconset/up_16.png" alt="Parent Category" border="0" />
<? endif; ?>

<?= $this -> renderStatus($cmd)?>

<table width="650" border="0" id="list">
  <tr>
    <td bgcolor="#CCCCCC" width="30">Id</td>
    <td bgcolor="#CCCCCC" width="200">Name</td>
    <td bgcolor="#CCCCCC" width="200">Parent</td>
    <td bgcolor="#CCCCCC" width="70">ad. Count</td>
    <td bgcolor="#CCCCCC" width="60">Sub Cat.</td>
    <td bgcolor="#CCCCCC" width="40">Edit</td>
    <td bgcolor="#CCCCCC" width="40">Delete</td>
  </tr>
  <?php
  foreach($arrCategories as $category):  
  $urlDelete = "?page=categoryManager&sub=delcategory&pCatId=$pCatId&catId=$category[categoryID]";
  $urlEdit = "?page=categoryManager&pCatId=$pCatId&catId=$category[categoryID]";
  $urlSub = "?page=categoryManager&pCatId=$category[categoryID]";
  
  ?>
  <tr>
  	<td><?=$category['categoryID']?></td>
    <td><?=$category['categoryName']?></td>
    <td><?=$parentName?></td>
    <td align="center">0</td>
    <td align="center"><a href="<?=$urlSub?>"><img src="iconset/label_16.png" alt="Sub Categories" border="0" /></a></td>    
    <td align="center"><a href="<?=$urlEdit?>"><img src="iconset/pencil_16.png" alt="Edit" border="0" /></a></td>
    <td align="center"><img src="iconset/delete_16.png" alt="Delete" onclick="doDelete('<?= $urlDelete?>')" /></td>
  </tr>
  <?php
  endforeach;
  ?>
</table>

</div>
</div>
<!-- RIGHT END -->

<!-- Just to increase height automatically --><div id="height_increaser"></div>

</div>
<!-- CONTENT END -->
<div id="content_end"></div>